/**
 * 
 */
package mm.front.jsf.mb;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import org.apache.log4j.Logger;

/**
 * @author PUSDERKIS
 *
 */
public abstract class MMAbstractManagedBean {
	
	protected Logger logger = Logger.getLogger(this.getClass());

	private FacesMessage createFacesMessage(String message){
		FacesMessage fm = new FacesMessage(message);
		return fm;
	}
	
	protected void addInfoMessage(String clientId,String message){
		FacesMessage fm = createFacesMessage(message);
		fm.setSeverity(FacesMessage.SEVERITY_INFO);
		getFacesContext().addMessage(clientId, fm);
				
	}
	
	protected void addErrorMessage(String clientId, String message){
		FacesMessage fm = createFacesMessage(message);
		fm.setSeverity(FacesMessage.SEVERITY_ERROR);
		getFacesContext().addMessage(clientId, fm);
	}
	
	protected FacesContext getFacesContext(){
		return FacesContext.getCurrentInstance();
	}
	
}
